package com.briup.cms.web.controller;

import com.briup.cms.bean.Inform;
import com.briup.cms.bean.RolePrivilege;
import com.briup.cms.service.IInformService;
import com.briup.cms.utils.Message;
import com.briup.cms.utils.MessageUtil;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;
@Api(description = "通知管理相关接口")
@RestController
@RequestMapping("/inform")
public class InformController {

    @Autowired
    private IInformService InformService;

    @ApiOperation(value = "查询所有")
    @GetMapping("findAll")
    public Message findAll (){
        List<Inform> list = InformService.findAll();
        return MessageUtil.success(list);
    }
    @ApiOperation(value = "保存")
    @GetMapping("save")
    public Message save(Inform inform){
        InformService.save(inform);
        return MessageUtil.success("保存成功");
    }
    @ApiOperation(value = "更新")
    @PostMapping("update")
    public Message update(Inform inform){
        InformService.update(inform);
        return MessageUtil.success("更新成功");
    }
    @ApiOperation(value = "删除")
    @GetMapping ("delete")
    public Message delete(Inform inform) {
        InformService.delete(inform);
        return MessageUtil.success("删除成功") ;
    }

}